A stacked, spline line chart
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.key.js"></script>
<script src="RGraph.line.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">
[No canvas support]
</canvas>
This is the code that generates the chart:
<script>
window.onload = function ()
{
var mline = new RGraph.Line({
id: 'cvs',
data: [
[4,6,12,16,8,4,2,8,18,16,14,16],
[2,4,8,4,2,6,6,12,8,10,6,8],
[1,3.5,5,3,4,5,6,11,8,9,5,7]
],
options: {
labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
gutterLeft: 40,
gutterTop: 35,
gutterRight: 15,
gutterBottom: 35,
colors: ['black', 'black', 'black'],
filled: true,
filledAccumulative: true,
fillstyle: ['Gradient(white:red)', 'Gradient(white:blue)', 'Gradient(white:green)'],
unitsPost: '%',
linewidth: 0.25,
spline: !RGraph.ISOLD,
title: 'Robert, Daniel and Janices stats',
titleVpos: 0.5,
textColor: '#333',
textFont: 'Arial',
key: ['Robert', 'Daniel', 'Janice'],
keyColors: ['red', 'blue', 'green'],
keyBackground: 'white',
keyPositionX: 50,
shadowOffsety: 2,
shadowBlur: 5,
tickmarks: null,
backgroundGridAutofitNumvlines: 11,
numxticks: 11,
textAccessible: true
}
}).on('beforedraw', function (obj)
{
RGraph.clear(obj.canvas, 'white');
})
.draw()
.trace2({frames: 60});
};
</script>